package study.javaee.practice.utils.security;

import cn.hutool.crypto.digest.MD5;
import org.springframework.stereotype.Component;
import study.javaee.practice.property.SecurityProperty;

@Component
public class MyPasswordEncoder {
    MD5 encoder;

    public MyPasswordEncoder(SecurityProperty securityProperty){
        encoder = new MD5(securityProperty.getSalt().getBytes(), 1);
    }

    public String encode(String password, String salt) {
        return encoder.digestHex(password + salt);
    }


}
